<template>
	<view class="paid-win" >
		<view class="paid">
			<view class="paymen-success">
				<view class="paid-img">
					<view class="img">
						<image src="http://wx.xiongmaovip.com/miniapp/static/fuel/pay-affirm.png" mode=""></image>
					</view>
				</view>
				<view class="winmsg">支付成功</view>
				<!-- 				<view class="price">
					<view class="actually-paid">
						<text>￥</text>
						{{consumptionInfo.realAmt}}
					</view>
					<view class="original-price" style="text-decoration:line-through;"
						v-if="consumptionInfo.fuelAmt > consumptionInfo.realAmt">￥{{consumptionInfo.fuelAmt}}</view>
					<view class="name">{{consumptionInfo.stationName}}</view>
				</view> -->
				<image class="result-img" src="http://wx.xiongmaovip.com/miniapp/static/fuel/pay-bg.png" mode=""></image>
			</view>
			<view style="padding: 0px 46rpx;">
				<view class="muzzle">
					<view class="price">
						<text>￥</text>
						{{consumptionInfo.realAmt}}
					</view>
					<view class="name">{{consumptionInfo.stationName}}</view>
					<view class="br">

					</view>
					<view class="item">
						<view class="left">订单号：</view>
						<view class="right">{{consumptionInfo.sourceOrderId}}</view>
					</view>
					<view class="item">
						<view class="left">支付时间：</view>
						<view class="right">{{getTime() || ''}}</view>
					</view>
				</view>
			</view>
		</view>
		<view @click="close" class="go-home">
			返回首页
		</view>
	</view>
</template>

<script>
	// import {
	// 	getFuelOrderInfo
	// } from '@/api/index'
	export default {
		data() {
			return {
				paidOrderId: null,
				consumptionInfo: {},
				queryInterval: false,
				timer: null,
				pageShow: false
			};
		},
		onLoad(option) {
			console.log('onLoad')
			console.log(option)
			this.consumptionInfo = JSON.parse(option.orderinfo)
			// this.getPayResultInfo(0)
		},
		methods: {
			getTime() {
				const now = new Date();
				const year = now.getFullYear();
				const month = ('0' + (now.getMonth() + 1)).slice(-2);
				const day = ('0' + now.getDate()).slice(-2);
				const hours = ('0' + now.getHours()).slice(-2);
				const minutes = ('0' + now.getMinutes()).slice(-2);
				const seconds = ('0' + now.getSeconds()).slice(-2);
				return year + '-' + month + '-' + day + '-' + hours + ':' + minutes + ':' + seconds;
			},
			// getPayResultInfo(time) {
			// 	uni.showLoading({
			// 		title: '加载中...'
			// 	})
			// 	const self = this
			// 	self.timer = setTimeout(() => {
			// 		getFuelOrderInfo({
			// 			orderId: self.paidOrderId
			// 		}).then(res => {
			// 			console.log(res, 'payInfo')
			// 			if (res) {
			// 				if (res.paidStatus == 1) {
			// 					clearTimeout(self.timer)
			// 					uni.hideLoading()
			// 					self.consumptionInfo = res
			// 					self.pageShow = true
			// 				} else {
			// 					self.getPayResultInfo(5000)
			// 				}
			// 			} else {
			// 				clearTimeout(self.timer)
			// 				uni.hideLoading()
			// 				console.log(res, '获取支付信息错误')
			// 			}
			// 		}).catch(error => {
			// 			clearTimeout(self.timer)
			// 			uni.hideLoading()
			// 			console.log(error)
			// 		})
			// 	}, time)
			// },
			close() {
				uni.reLaunch({
					url: '../../index/index'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.paymen-success {
		padding: 20rpx 0rpx 128rpx 0rpx;
		background: #006241;
		position: relative;

		.paid-img {
			.img {
				width: 200rpx;
				height: 200rpx;
				margin: auto;

				image {
					width: 100%;
					height: 100%;
				}
			}
		}

		.winmsg {
			font-size: 40rpx;
			color: #ffffff;
			line-height: 56rpx;
			text-align: center;
		}

		.result-img {
			position: absolute;
			width: 100%;
			height: 84rpx;
			bottom: 0px;
		}

		.price {
			text-align: center;

			.actually-paid {
				font-size: 60rpx;
				color: #333333;
				line-height: 72rpx;
				text-align: center;
				margin-bottom: 26rpx;

				text {
					font-size: 40rpx;
					color: #333333;
				}
			}

			.original-price {
				margin-bottom: 20rpx;
			}

			.name {
				text-align: center;
				font-size: 26rpx;
				color: #999999;
				line-height: 26rpx;
			}
		}
	}

	.muzzle {
		background: #ffffff;
		padding: 0px 46rpx 40rpx 46rpx;
		text-align: center;

		.price {
			font-size: 50rpx;
			color: #2d2b2a;
			line-height: 40rpx;

			text {
				font-size: 28rpx;
			}
		}

		.name {
			font-size: 28rpx;
			color: #939391;
			line-height: 40rpx;
			margin-top: 16rpx;
			margin-bottom: 40rpx;
		}

		.br {
			border: 1px dashed #eeeeee;
			opacity: 0.5;
			margin-bottom: 40rpx;
		}

		.item {
			display: flex;
			align-items: center;
			justify-content: left;
			font-size: 28rpx;
			line-height: 40rpx;
			margin-bottom: 24rpx;

			.lfet {
				color: #939391;
			}

			.right {
				color: #2d2b2a;
			}
		}
	}

	.go-home {
		width: 320rpx;
		line-height: 96rpx;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		border: 2rpx solid #006241;
		text-align: center;
		font-size: 32rpx;
		font-weight: 500;
		color: #006241;
		margin: 80rpx auto 0upx auto;
	}
</style>